# specify header and cpp files
enable_language(CUDA)
file(GLOB_RECURSE  faiss_gpu_headers ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
file(GLOB_RECURSE  faiss_gpu_cpp ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
file(GLOB_RECURSE  faiss_gpu_cuh ${CMAKE_CURRENT_SOURCE_DIR}/*.cuh)
file(GLOB_RECURSE  faiss_gpu_cu ${CMAKE_CURRENT_SOURCE_DIR}/*.cu)

set(faiss_lib_gpu gpufaiss)

file(GLOB faiss_gpu_perf_cpp ${CMAKE_CURRENT_SOURCE_DIR}/perf/*.cpp)
foreach(source ${faiss_gpu_perf_cpp})
	list(REMOVE_ITEM faiss_gpu_cpp ${source})
endforeach(source)

file(GLOB faiss_gpu_perf_headers ${CMAKE_CURRENT_SOURCE_DIR}/perf/*.h)
foreach(source ${faiss_gpu_perf_headers})
	list(REMOVE_ITEM faiss_gpu_headers ${source})
endforeach(source)

file(GLOB faiss_gpu_perf_cu ${CMAKE_CURRENT_SOURCE_DIR}/perf/*.cu)
foreach(source ${faiss_gpu_perf_cu})
	list(REMOVE_ITEM faiss_gpu_cu ${source})
endforeach(source)

file(GLOB faiss_gpu_perf_cuh ${CMAKE_CURRENT_SOURCE_DIR}/perf/*.cuh)
foreach(source ${faiss_gpu_perf_cuh})
	list(REMOVE_ITEM faiss_gpu_cuh ${source})
endforeach(source)

file(GLOB faiss_gpu_test_cpp ${CMAKE_CURRENT_SOURCE_DIR}/test/*.cpp)
foreach(source ${faiss_gpu_test_cpp})
	list(REMOVE_ITEM faiss_gpu_cpp ${source})
endforeach(source)

file(GLOB faiss_gpu_test_headers ${CMAKE_CURRENT_SOURCE_DIR}/test/*.h)
foreach(source ${faiss_gpu_test_headers})
	list(REMOVE_ITEM faiss_gpu_headers ${source})
endforeach(source)

file(GLOB faiss_gpu_test_cu ${CMAKE_CURRENT_SOURCE_DIR}/test/*.cu)
foreach(source ${faiss_gpu_test_cu})
	list(REMOVE_ITEM faiss_gpu_cu ${source})
endforeach(source)

file(GLOB faiss_gpu_test_cuh ${CMAKE_CURRENT_SOURCE_DIR}/test/*.cuh)
foreach(source ${faiss_gpu_test_cuh})
	list(REMOVE_ITEM faiss_gpu_cuh ${source})
endforeach(source)
# list(remove_item faiss_gpu_cpp ${cmake_current_source_dir}/test/demo_ivfpq_indexing_gpu.cpp)
# list(remove_item faiss_gpu_cpp ${cmake_current_source_dir}/test/testgpuindexflat.cpp)
# list(remove_item faiss_gpu_cpp ${cmake_current_source_dir}/test/testgpuindexivfflat.cpp)
# list(remove_item faiss_gpu_cpp ${cmake_current_source_dir}/test/testgpuindexivfpq.cpp)
# list(remove_item faiss_gpu_cpp ${cmake_current_source_dir}/test/testutils.cpp)
# list(remove_item faiss_gpu_cu ${cmake_current_source_dir}/test/testgpuselect.cu)
# list(remove_item faiss_gpu_headers ${cmake_current_source_dir}/test/testutils.h)
# list(remove_item faiss_gpu_headers ${cmake_current_source_dir}/perf/indexwrapper.h)
# list(remove_item faiss_gpu_headers ${cmake_current_source_dir}/perf/indexwrapper-inl.h)
# list(remove_item faiss_gpu_cu ${cmake_current_source_dir}/perf/perfbinaryflat.cu)
# list(remove_item faiss_gpu_cu ${cmake_current_source_dir}/perf/perfflat.cu)
# list(remove_item faiss_gpu_cu ${cmake_current_source_dir}/perf/perfivfpq.cu)
# list(remove_item faiss_gpu_cu ${cmake_current_source_dir}/perf/perfselect.cu)
# list(remove_item faiss_gpu_cpp ${cmake_current_source_dir}/perf/perfclustering.cpp)
# list(remove_item faiss_gpu_cpp ${cmake_current_source_dir}/perf/perfivfpqadd.cpp)
# list(remove_item faiss_gpu_cpp ${cmake_current_source_dir}/perf/writeindex.cpp)

add_library(${faiss_lib_gpu} STATIC ${faiss_gpu_headers} ${faiss_gpu_cpp} ${faiss_gpu_cuh} ${faiss_gpu_cu}) 
